<template>
    <div>
        <van-search  placeholder="请输入搜索关键词" />
        <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
            <van-swipe-item v-for="lbt1 in lbtList">
                <van-image
                        width="100%"
                        height="200px"
                        fit="contain"
                        :src="'http://192.168.40.177:8008/api'+ lbt1.pic"
                />
            </van-swipe-item>
            <van-swipe-item v-for="lbt2 in lbtList">
                <van-image
                        width="100%"
                        height="200px"
                        fit="contain"
                        :src="'http://192.168.40.177:8008/api'+ lbt2.pic"
                />
            </van-swipe-item>
            <van-swipe-item v-for="lbt3 in lbtList">
                <van-image
                        width="100%"
                        height="200px"
                        fit="contain"
                        :src="'http://192.168.40.177:8008/api'+ lbt3.pic"
                />
            </van-swipe-item>
        </van-swipe>
        <van-grid>
            <van-grid-item :icon="'http://192.168.40.177:8008/api'+daohanganniu.pic" :text="daohanganniu.name" v-for="daohanganniu in daohanganniuList" />
        </van-grid>
        <div style="margin-top: 10px; padding-left: 20px; background-color: white">
            精品推荐：
        </div>
        <!--    <van-grid column-num="2" :border="false">-->
        <!--      <van-grid-item icon="http://192.168.40.177:8008/api/file/pic/2b61d366-9ff9-4e1b-b99c-f9fd7c4c4908_source.jpg" text="华为畅享6S钢化膜" />-->
        <!--      <van-grid-item icon="http://192.168.40.177:8008/api/file/pic/f287662b-3f86-43ac-bf71-df5db2b97b65_source.jpg" text="华为Nova全屏覆盖钢化玻璃膜" />-->
        <!--      <van-grid-item icon="http://192.168.40.177:8008/api/file/pic/62920974-c86b-4e69-be76-7f641fccfcc9_source.jpg" text="小米(MI) MIX2"/>-->
        <!--      <van-grid-item icon="http://192.168.40.177:8008/api/file/pic/cd7715a9-ad05-453c-8efd-2dbcb21171cf_source.jpg" text="苹果(Apple) iPhone SE"></van-grid-item>-->
        <!--      <van-grid-item icon="http://192.168.40.177:8008/api/file/pic/6c1f1007-47a9-4231-995b-5f7858510087_source.jpg" text="魔睿(MORUI) 移动电源"></van-grid-item>-->
        <!--      <van-grid-item icon="http://192.168.40.177:8008/api/file/pic/94b07fa9-beab-4329-9a67-1a6259bef972_source.jpg" text="浪漫姐妹 秋冬毛呢西装外套"></van-grid-item>-->
        <!--    </van-grid>-->
        <van-grid :border="false" :column-num="2">
            <van-grid-item v-for="goods in jingpingList" @click="tocommodity(goods)">
                <van-image :src="'http://192.168.40.177:8008/api'+goods.image" />
                <p class="name">{{goods.storeName}}</p>
                <div>
                    <span class="xianjia">{{goods.price}}</span>
                    <span class="yuanjia">{{goods.otPrice}}</span>
                </div>
            </van-grid-item>
            <!--      <van-grid-item>-->
            <!--        <van-image src="http://192.168.40.177:8008/api/file/pic/f287662b-3f86-43ac-bf71-df5db2b97b65_source.jpg" />-->
            <!--      </van-grid-item>-->
            <!--      <van-grid-item>-->
            <!--        <van-image src="http://192.168.40.177:8008/api/file/pic/cd7715a9-ad05-453c-8efd-2dbcb21171cf_source.jpg" />-->
            <!--      </van-grid-item>-->
            <!--      <van-grid-item>-->
            <!--        <van-image src="http://192.168.40.177:8008/api/file/pic/cd7715a9-ad05-453c-8efd-2dbcb21171cf_source.jpg" />-->
            <!--      </van-grid-item>-->
            <!--      <van-grid-item>-->
            <!--        <van-image src="http://192.168.40.177:8008/api/file/pic/6c1f1007-47a9-4231-995b-5f7858510087_source.jpg" />-->
            <!--      </van-grid-item>-->
            <!--      <van-grid-item>-->
            <!--        <van-image src="http://192.168.40.177:8008/api/file/pic/cd7715a9-ad05-453c-8efd-2dbcb21171cf_source.jpg" />-->
            <!--      </van-grid-item>-->
            <!--      <van-grid-item>-->
            <!--        <van-image src="http://192.168.40.177:8008/api/file/pic/94b07fa9-beab-4329-9a67-1a6259bef972_source.jpg" />-->
            <!--      </van-grid-item>-->

        </van-grid>
        <h4 class="title">猜你喜欢：</h4>
        <van-card
                v-for="Likegoods in likes"
                tag="Like"
                :price="Likegoods.price"
                :desc="Likegoods.price"
                :title="Likegoods.storeName"
                :thumb="'http://192.168.40.177:8008/api'+Likegoods.image"
                :origin-price="Likegoods.otPrice"
        />
        <TabBar></TabBar>
    </div>



</template>
<script>
    import {add,jian,cheng,chu} from '@/utils/jisuan'
    import axios from 'axios'
    import {getjingpingListData, getLikesData, getLunboData,getdaohanganniuData} from "@/api/index";
    export default {
        name:"app",
        data(){
            return{
                lbtList:[
                    {
                        fit:"contain",
                        img:"http://192.168.40.177:8008/api/file/pic/20210811171949464257.jpg"
                    },
                    {
                        fit:"contain",
                        img:"http://192.168.40.177:8008/api/file/pic/20210706113003285731.jpg"
                    },
                    {
                        fit:"contain",
                        img:"http://192.168.40.177:8008/api/file/pic/20210706113002899088.jpg"
                    }
                ],
                likes:[
                    {
                        price:4699.00,
                        desc:"不失商务不失娱乐",
                        title:"小米(MI)MIX2",
                        thumb:"http://192.168.40.177:8008/api/file/pic/62920974-c86b-4e69-be76-7f641fccfcc9_source.jpg",
                        originprice:4700.00,
                        zhekou:0.8
                    }
                ],
                daohanganniuList:[
                    {
                        img1: "http://192.168.40.177:8008/api/file/pic/20210706113004249956.png",
                        text1: "全部商品"
                    },
                    {
                        img1: "http://192.168.40.177:8008/api/file/pic/20210706113002112555.png",
                        text1: "优惠券"
                    },
                    {
                        img1: "http://192.168.40.177:8008/api/file/pic/20210706113005744845.png",
                        text1: "积分商品"
                    },
                    {
                        img1: "http://192.168.40.177:8008/api/file/pic/20210706113007048337.png",
                        text1: "积分签到"
                    }
                ],
                jingpingList:[
                    {
                        img:"http://192.168.40.177:8008/api/file/pic/2b61d366-9ff9-4e1b-b99c-f9fd7c4c4908_source.jpg",
                        name:"华为畅享6S钢化膜",
                        xianjia:"$30.00",
                        yuanjia:"$34.00"
                    },
                    {
                        img:"http://192.168.40.177:8008/api/file/pic/f287662b-3f86-43ac-bf71-df5db2b97b65_source.jpg",
                        name:"华为Nova全屏覆盖钢化玻璃膜",
                        xianjia:"$30.00",
                        yuanjia:"$34.00"
                    },
                    {
                        img:"http://192.168.40.177:8008/api/file/pic/62920974-c86b-4e69-be76-7f641fccfcc9_source.jpg",
                        name:"华为Nova全屏覆盖钢化玻璃膜",
                        xianjia:"$30.00",
                        yuanjia:"$34.00"
                    },
                    {
                        img:"http://192.168.40.177:8008/api/file/pic/6c1f1007-47a9-4231-995b-5f7858510087_source.jpg",
                        name:"华为Nova全屏覆盖钢化玻璃膜",
                        xianjia:"$30.00",
                        yuanjia:"$34.00"
                    },
                    {
                        img:"http://192.168.40.177:8008/api/file/pic/cd7715a9-ad05-453c-8efd-2dbcb21171cf_source.jpg",
                        name:"华为Nova全屏覆盖钢化玻璃膜",
                        xianjia:"$30.00",
                        yuanjia:"$34.00"
                    },
                    {
                        img:"http://192.168.40.177:8008/api/file/pic/94b07fa9-beab-4329-9a67-1a6259bef972_source.jpg",
                        name:"华为Nova全屏覆盖钢化玻璃膜",
                        xianjia:"$30.00",
                        yuanjia:"$34.00"
                    }
                ]
            }
        },
        created() {
            console.log("界面创建完毕 还未加载界面")
            //获取轮播图数据
            this.getlbtList()
            this.getdaohanganniuList()
            this.getjingpingList()
            this.getLikes()

            add(3,3)
            jian(2,1)
            cheng(3,5)
            chu(3,2)


        },
        methods:{
            tocommodity(goods){
              console.log(goods.storeName)

                const id = goods.id

                this.$router.push("/commodity/" + id)

            },
            getlbtList(){
                getLunboData().then(res=>{

                    console.log(res)

                    /*  // res = {
                      // data:{msg:"操作成功",status:200, success:true, time:"2025-03-15 10:54:37"}
                      // }*/
                    //对象的取值
                    const data=res.data

                    //获取轮播图的数据
                    const  da=data.data
                    //将获取到的轮播图数据传递给页面
                    this.$data.lbtList=da


                })
            },
            getdaohanganniuList(){
                getdaohanganniuData().then(res=>{

                    console.log(res)

                    /*  // res = {
                      // data:{msg:"操作成功",status:200, success:true, time:"2025-03-15 10:54:37"}
                      // }*/

                    //对象的取值
                    const data=res.data

                    //获取轮播图的数据
                    const  da=data.data
                    //将获取到的轮播图数据传递给页面
                    this.$data.daohanganniuList=da


                })
            },
            getjingpingList(){
                getjingpingListData().then(res=>{

                    console.log(res)

                    /*  // res = {
                      // data:{msg:"操作成功",status:200, success:true, time:"2025-03-15 10:54:37"}
                      // }*/

                    //对象的取值
                    const data=res.data

                    //获取轮播图的数据
                    const  da=data.data
                    //将获取到的轮播图数据传递给页面
                    this.$data.jingpingList=da


                })
            },
            getLikes(){
                getLikesData().then(res=>{

                    console.log(res)

                    /*  // res = {
                      // data:{msg:"操作成功",status:200, success:true, time:"2025-03-15 10:54:37"}
                      // }*/

                    //对象的取值
                    const data=res.data

                    //获取轮播图的数据
                    const  da=data.data
                    //将获取到的轮播图数据传递给页面
                    this.$data.likes=da


                })
            }
        }

    }


</script>
<style>
    .van-search .van-cell {
        height: 10px;
        align-items: center;
    }
    .van-grid-item__icon{
        font-size: 40px !important;
    }
    .van-grid-item__text{
        font-size: 16px !important;
    }
    .xianjia{
        font-size: 20px;
        color: #ffaf76;
    }
    .yuanjia{
        font-size: 12px;
        margin-left: 10px;
        color:darkgrey ;
        text-decoration: line-through;
    }
    .van-card__price{
        font-size: 20px !important;
        color: rgb( 238, 136, 59) !important;
    }
    .van-card__price-integer{
        font-size: 20px !important ;
    }
   
</style>
